/* All ships are instances of this class
 * 
 */

package item.ship;

import java.util.ArrayList;

import item.Item;
import item.Rarity;
import item.weapon.Weapon;
import item.defense.Defense;
import item.engine.Engine;
import item.mod.Mod;
import status.Status;


public class Ship extends Item {
	
	
	private int mHull; //the maximum hull
	private int cHull; //the current hull
	private int mArmor; //the maximum armor
	private int cArmor; //the current armor
	private int mShields; //the maximum shields
	private int cShields; //the current shields
	private int maxNumWeapons; //the maximum number of weapons
	private int maxNumDefenseItems; //the maximum number of defensive items
	private int maxNumEngines; //the maximum number of engines
	private int maxNumMods; //the maximum number of mods
	private ArrayList<Weapon> weapons; //the list of weapons on the ship
	private ArrayList<Defense> defenseItems; //the list of defensive items
	private ArrayList<Engine> engines; //the list of engines
	private ArrayList<Mod> mods; //the list of modifications
	private String shipClass; //the class of the ship
	private ArrayList<String> shipAttributes; //used to mark the ship with
		//certain attributes used for determining if the ship can equip
		//certain items
	private ArrayList<Status> statuses; //the list of statuses that will be
		//created and updated during battle
	
	
	//the main constructor that makes the ship
	public Ship(String n, int c, int w, String sP, Rarity r, int h, int a,
			int s, int mw, int md, int me, int mm, String sC,
			ArrayList<String> sT){

		super(n, c, w, sP, r);
		
		mHull = h;
		cHull = mHull;
		mArmor = a;
		cArmor = mArmor;
		mShields = s;
		cShields = mShields;
		maxNumWeapons = mw;
		maxNumDefenseItems = md;
		maxNumEngines = me;
		maxNumMods = mm;
		weapons = new ArrayList<Weapon>();
		defenseItems = new ArrayList<Defense>();
		engines = new ArrayList<Engine>();
		mods = new ArrayList<Mod>();
		shipClass = sC;		
		shipAttributes = new ArrayList<String>();
		
		for(String at: sT)
			shipAttributes.add(at);		
	}//17 param constructor


	//returns the maximum hull of the ship
	public int getmHull() {

		return mHull;
	}//getmHull

	
	//sets the max hull
	public void setmHull(int mHull) {
		
		this.mHull = mHull;
	}//setmHull


	//returns the current hull
	public int getcHull() {
		
		return cHull;
	}//getcHull


	//sets the current hull
	public void setcHull(int cHull) {
		
		this.cHull = cHull;
	}//setcHull


	//returns the max armor
	public int getmArmor() {
		
		return mArmor;
	}//getmArmor


	//sets the max armor
	public void setmArmor(int mArmor) {
		
		this.mArmor = mArmor;
	}//setmArmor


	//returns the current armor
	public int getcArmor() {
		
		return cArmor;
	}//getcArmor


	//sets the current armor
	public void setcArmor(int cArmor) {
		
		this.cArmor = cArmor;
	}//setcArmor


	//returns the max shields
	public int getmShields() {
		
		return mShields;
	}//getmShields


	//sets the max shields
	public void setmShields(int mShields) {
		
		this.mShields = mShields;
	}//getcShields


	//returns the current shields
	public int getcShields() {
		
		return cShields;
	}//getcShields


	//sets the current shields
	public void setcShields(int cShields) {
		
		this.cShields = cShields;
	}//setcShields


	//returns the equipped weapons
	public ArrayList<Weapon> getWeapons() {
		
		return weapons;
	}//getWeapons


	//returns the equipped defensive items
	public ArrayList<Defense> getDefensiveItems() {
		
		return defenseItems;
	}//getDefensiveItems


	//returns the equipped engines
	public ArrayList<Engine> getEngines() {
		
		return engines;
	}//getEngines


	//returns the equipped mods
	public ArrayList<Mod> getMods() {
		
		return mods;
	}//getMods


	//returns the class of the ship
	public String getShipClass() {
		
		return shipClass;
	}//getShipClass
	
	
	//equips the weapon if possible
	public boolean equip(Weapon w){
		
		if(this.canEquip(w)){
			
			weapons.add(w);
			return true;
		}//if
		
		return false;
	}//equip (Weapon)
	
	
	//equips the defensive item if possible
	public boolean equip(Defense d){
		
		if(this.canEquip(d)){
			
			defenseItems.add(d);
			return true;
		}//if
		
		return false;
	}//equip (Defense)

	
	//equips the modification if possible
	public boolean equip(Mod m){
		
		if(this.canEquip(m)){
			
			mods.add(m);
			return true;
		}//if
		
		return false;
	}//
	
	//equips the engine if possible
	public boolean equip(Engine e){
		
		if(this.canEquip(e)){
			
			engines.add(e);
			return true;
		}//if
		
		return false;
	}//equip (Engine)
	

	//unequips the weapon
	public void unequip(Weapon w){
		
		weapons.remove(w);
	}//unequip (Weapon)
	

	//unequips the defensive item
	public void unequip(Defense d){
		
		defenseItems.remove(d);
	}//unequip (Defense)
	

	//unequips the mod
	public void unequip(Mod m){
		
		mods.remove(m);
	}//unequip (Mod)
	

	//unequips the engine
	public void unequip(Engine e){
		
		engines.remove(e);
	}//unequip (Engine)
	
	
	//returns if the ship can equip the weapon
	private boolean canEquip(Weapon w){
		
		return true;
	}//canEquip (Weapon)
	
	
	//returns if the ship can equip the defensive item
	private boolean canEquip(Defense d){
		
		return true;
	}//canEquip (Defense)
	
	
	//returns if the ship can equip the engine
	private boolean canEquip(Engine e){
		
		return true;
	}//canEquip (Engine)
	
	
	//returns if the ship can equip the mod
	private boolean canEquip(Mod m){
		
		return true;
	}//canEquip (Mod)
}//Ship